package cn.edu.cqut.base.util;

import android.app.AlertDialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

public class AlertDialogUtil {

	public static AlertDialog createDialog(Context context, int layout) {
		AlertDialog dialog = new AlertDialog.Builder(context).create();
		Window window = dialog.getWindow();
		WindowManager.LayoutParams wl = window.getAttributes();
		wl.alpha = 0.8f;
		View view = LayoutInflater.from(context).inflate(layout, null);
		dialog.setView(view);
		dialog.show();
		dialog.setContentView(layout);
		dialog.setCancelable(false);
		return dialog;
	}
}
